﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.IO;

namespace InoutChecker
{
    public class InoutChecker
    {
        private string site_addr = "http://work.reflexion.co.kr/proc/admin/login";
        private string id;
        private string password;

        public InoutChecker(string user_name, string pwd)
        {
            id = user_name;
            password = pwd;
        }

        public WebResponse InCheck()
        {
            HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(site_addr + "/admin_logon_ok.asp");
            req.Method = "POST";
            req.ContentType = "application/x-www-form-urlencoded";
            req.Accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*";
            req.Referer = "http://work.reflexion.co.kr/proc/admin/login/admin_logon.asp";
            req.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727)";
            req.ContentLength = (long)double.Parse("50");
            req.Headers.Add("Cookie", "memberID=kangjin98; ASPSESSIONIDQSASQTTT=ADOFHMFBNIICHEFELJAPAHIN; ASPSESSIONIDCASSQRQQ=MJKJHHNCEGPOMLOIHCOJONDN");
            
            using (StreamWriter writer = new StreamWriter(req.GetRequestStream())){
                writer.Write(string.Format("ret_page=&userID={0}&passwd={1}&enterCD=1", id, password));
            }

            return req.GetResponse();
        }
    }
}